feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration#137
Draft
feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration#137
Conversation
…or GHAS demonstration Co-authored-by: CalinL <10718943+CalinL@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add DevSecOps page with news and insecure code sample
feat: Add DevSecOps-7809 demo page with intentional vulnerabilities for GHAS demonstration
Feb 10, 2026
| string jsonData = JsonConvert.SerializeObject(LatestSecurityNews); | ||
|
|
||
| // VULNERABILITY: Deserializing untrusted data without validation | ||
| var deserializedData = JsonConvert.DeserializeObject<List<NewsItem>>(jsonData); |
| catch (Exception ex) | ||
| { | ||
| // VULNERABILITY: Excessive error information disclosure | ||
| _logger.LogError($"Failed to process input '{userInput}': {ex.ToString()}"); |
| // VULNERABILITY: Log forging - user input directly in logs without sanitization | ||
| // Attackers could inject newlines and fake log entries | ||
| string userAgent = Request.Headers.UserAgent.ToString(); | ||
| string userName = Request.Query.ContainsKey("user") ? Request.Query["user"].ToString() ?? "anonymous" : "anonymous"; |
| LoadLatestGHASNews(); | ||
|
|
||
| // Demonstrate potential ReDoS vulnerability with query parameter | ||
| string testPattern = Request.Query.ContainsKey("pattern") ? Request.Query["pattern"].ToString() ?? "aaa" : "aaa"; |
Comment on lines
+64
to
+68
| catch (Exception ex) | ||
| { | ||
| // VULNERABILITY: Log forging in exception handling with full stack trace | ||
| _logger.LogError($"Regex evaluation failed for pattern: {testPattern}. Error: {ex}"); | ||
| } |
Comment on lines
+78
to
+81
| catch (Exception ex) | ||
| { | ||
| _logger.LogError($"Database connection failed: {ex.Message}"); | ||
| } |
Comment on lines
+176
to
+181
| catch (Exception ex) | ||
| { | ||
| // VULNERABILITY: Excessive error information disclosure | ||
| _logger.LogError($"Failed to process input '{userInput}': {ex.ToString()}"); | ||
| TempData["ErrorMessage"] = $"Error: {ex.Message}"; | ||
| } |
Comment on lines
+211
to
+216
| catch (Exception ex) | ||
| { | ||
| // VULNERABILITY: Logging full exception details with user input | ||
| _logger.LogError($"Regex test failed for pattern: {regexPattern}. Exception: {ex}"); | ||
| TempData["ErrorMessage"] = "Pattern evaluation failed"; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new DevSecOps demo page (7809) showcasing GitHub Advanced Security detection capabilities through intentional security vulnerabilities in an ASP.NET Core Razor Pages application.
Changes
New Demo Page
DevSecOps-7809.cshtml: UI with 2026 GHAS news, interactive vulnerability testing formsDevSecOps-7809.cshtml.cs: PageModel with ILogger and multiple vulnerability categoriesIntentional Vulnerabilities
^(a+)+$with nested quantifiersBuildUserQuery()Package Updates
Newtonsoft.Jsonfrom 13.0.1 → 12.0.2 (vulnerable version)System.Text.Json8.0.4,Microsoft.Data.SqlClient5.0.2Navigation
Index.cshtmlwith button linking to new demo pageAll vulnerabilities should trigger GHAS code scanning alerts, secret scanning, and dependency alerts.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.